import {localRead} from "/@/utils/local-util.js";
import LocalStorageKeyConst from "/@/constants/local-storage-key-const.js";
import {encryptData} from "/@/lib/encrypt.js";

const baseUrl = import.meta.env.VITE_APP_API_URL;
export const CommonConst = {
  baseUrl
}
export const CommonUtil = {
  baseUrl: baseUrl,
  encryptUrl: (fileKey) => {
    const token = localRead(LocalStorageKeyConst.USER_TOKEN);
    const encryptToken = encryptData(token)
    return baseUrl + `/support/file/downLoad?fileKey=${fileKey}&encryptToken=${encryptToken}`
  },
  encryptPdfUrl: (fileKey) => {
    const token = localRead(LocalStorageKeyConst.USER_TOKEN);
    const encryptToken = encryptData(token)
    return baseUrl + `/support/file/downLoadFile?fileKey=${fileKey}&encryptToken=${encryptToken}`
  }
}
